package com.pony.controller;

import com.pony.entity.Ly;
import com.pony.service.LyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@RequestMapping("/ly")
@Controller
public class LyController {

    @Autowired
    private LyService lyService;


    @RequestMapping("/getAllLy")
    public String getAllLy(Model model) {
        List<Ly> list = lyService.getAll();
        model.addAttribute("list", list);
        return "ly";
    }

    @RequestMapping("/delLy")
    public String delLy(int id){
        lyService.delLy(id);
        return "redirect:/ly/getAllLy.do";
    }
}
